package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.JSONUtil;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.*;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Setter
@Getter
@ToString
@AllArgsConstructor
@NoArgsConstructor
@JsonIgnoreProperties("handler")
//日报分类管理
public class DailyCatalog extends BaseDomain{

    public static final boolean STATE_ENABLE = true; //启用
    public static final boolean STATE_DISABLE = false; //禁用

    private String name;

    private Long dailyId;//日报的Id
    private String dailyTitle;//日报的标题

    private Integer sequence;//序列

    private boolean state=STATE_ENABLE;//状态 默认是开启状态

    //封装当前日报分类文章
    private List<DailyCatalog> catalogs =new ArrayList<>();

    public String getStateName(){
        String msg="启用";
        if (state==STATE_DISABLE) {
            msg="禁用";
        }
        return msg;

    }
    public String getJson() {
        Map<String, Object> map = new HashMap<>();
        map.put("id", id);
        map.put("name", name);
        map.put("dailyId", dailyId);
        map.put("sequence", sequence);
        map.put("state", state);
        return JSONUtil.toJSONString(map);
    }


}